/* EMU 1.1
 * 2012 Rogerio Drummond
 * IC, Unicamp
*/

package abstractions;

import java.io.Serializable;
import java.util.*;

// A Part represents all the eleemnts in a general selection.
// It is imutable and composed of: initial-string, a list of Atoms, final-string.
// The strings and the list of Atoms can be empty, but at least one of them must be
// non-empty for a proper Part.
// The Part always retains the original id of the Atoms so that Undo and Redo operations
// can reestore the original AtomIds used in the EMUDoc.
public class Part implements Serializable {
	String pt_inic;			// may be empty
	String pt_final;		// may be empty
	ArrayList<Atom> list;	// may be empty, new ids are generated after leaving the ClipBoard

	// EFFECTS: Copies the strings and the list of Atoms preserving their AtomIds.
	// Note: it has to copy the elements to keep the Part imutable.
	Part(Selection sel) {}

	
	public Part(String txt) {
		this.pt_inic = txt;
	}
	
	// Returns a String serialization of the Part.	
	public String toString() {
		return this.pt_inic;	
	}
}

